package com.grace.law.controller;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

import com.aliyun.odps.FileResource;
import com.aliyun.odps.Odps;
import com.aliyun.odps.Table;
import com.aliyun.odps.account.Account;
import com.aliyun.odps.account.AliyunAccount;

public class AdLogUpload {
	public void upload() throws Exception{
		Account account = new AliyunAccount("HwgihlTmsQu5SSOd", "");
		Odps odps = new Odps(account);
		
		String odpsUrl ="";
		odps.setEndpoint(odpsUrl);
		odps.setDefaultProject("count");
		Table table = odps.tables().get("tablename");
		
		String projectName="count";
		String source ="my_local_adlogs.txt";
		File file =new File(source);
		InputStream is = new FileInputStream(file);
		
		FileResource resource =new FileResource();
		String name = file.getName();
		resource.setName(name);
		odps.resources().create(projectName, resource, is);
		
		
		
	}
}
 